<extend name="Public/base" />

<style type="test/css">
.input_menu{ width:30px; text-align:center; height:12px; line-height:10px; margin:0; }
</style>

<block name="content">


<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i
				class="icon-home"></i> 首页</a> <a href="{:U('Auth/department')}" class="current">{$meta_title}</a>
		</div>
	</div>
	<div class="container-fluid">
		<br>
		<button id='export' class="btn btn-info" onclick="location.href='{:U('Auth/departmentAdd')}'">新 增</button>
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-content ">
						<!-- 表格列表 -->
						<div class="tb-unit posr">
							<div class="category">
								<div class="hd cf">
									<div class="fold">折叠</div>
									<div class="order">排序</div>
									<div class="order">状态</div>
									<div class="name">名称</div>
								</div>
								{:R('Auth/departmentTree', array($tree))}
							</div>
						</div>
						<!-- /表格列表 -->
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
(function($){
	/* 分类展开收起 */
	$(".category dd").prev().find(".fold i").addClass("icons-unfold")
		.click(function(){
			var self = $(this);
			if(self.hasClass("icons-unfold")){
				self.closest("dt").next().slideUp("fast", function(){
					self.removeClass("icons-unfold").addClass("icons-fold");
				});
			} else {
				self.closest("dt").next().slideDown("fast", function(){
					self.removeClass("icons-fold").addClass("icons-unfold");
				});
			}
		});

	/* 三级分类删除新增按钮 */
	$(".category dd dd .add-sub").remove();

	/* 实时更新分类信息 */
	$(".category")
		.on("submit", "form", function(){
			var self = $(this);
			$.post(
				self.attr("action"),
				self.serialize(),
				function(data){
					/* 提示信息 */
					var name = data.status ? "success" : "error", msg;
					msg = self.find(".msg").addClass(name).text(data.info)
							  .css("display", "inline-block");
					setTimeout(function(){
						msg.fadeOut(function(){
							msg.text("").removeClass(name);
						});
					}, 1000);
				},
				"json"
			);
			return false;
		})
        .on("focus","input",function(){
            $(this).data('param',$(this).closest("form").serialize());

        })
        .on("blur", "input", function(){
            if($(this).data('param')!=$(this).closest("form").serialize()){
                $(this).closest("form").submit();
            }
        });
})(jQuery);
highlight_subnav("{:U('Auth/department')}");
</script>
</block>
